import {HTTP} from '@/utils/HTTP.js'
import {useState, useEffect} from "react";

// 异步请求频道数据
const useMessageBoards = () => {
    const [messageBoardList, setMessageBoardList] = useState([])

    useEffect(() => {

        async function getMessageBoardList() {
            const res = await HTTP({
                url: '/messageBoard/find',
                method: 'GET'
            })
            setMessageBoardList(res.data)
        }

        getMessageBoardList()

    }, [])

    return {messageBoardList}
}

export default useMessageBoards